package com.example.controller;

import com.example.common.response.Result;
import com.example.service.FollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/follows")
public class FollowController {
    @Autowired
    private FollowService followService;

    @PostMapping("/{followingId}")
    public Result<Void> follow(@PathVariable Long followingId, @RequestParam Long followerId) {
        followService.follow(followerId, followingId);
        return Result.success(null);
    }

    @DeleteMapping("/{followingId}")
    public Result<Void> unfollow(@PathVariable Long followingId, @RequestParam Long followerId) {
        followService.unfollow(followerId, followingId);
        return Result.success(null);
    }

    @GetMapping("/{followingId}/status")
    public Result<Boolean> hasFollowed(@PathVariable Long followingId, @RequestParam Long followerId) {
        return Result.success(followService.hasFollowed(followerId, followingId));
    }
} 